package Entity;

import java.awt.List;
import java.io.Serializable;

/** this class Create new Instance of city*/

public class Cities implements Serializable {
	private static final long serialVersionUID = 42L;
	
	/**attributes for city*/
	static String [] citiesStringArr;
	static List cities;
	String CityID;
	String CityName;
	
	/**Full constructor with all attributes*/
	public Cities(String CityID,String CityName)
	{
	    setCityName(CityName);
		setCityID(CityID);
	}
	
	/**default constructor*/
	public Cities()
	{

	}
	
	/**set functions*/
	public static void setCities(List cities) 
	{
		Cities.cities = cities;
	}
  
	public void setCityID(String CityID)
    {
    	this.CityID=CityID;
    }
	
    public void setCityName(String CityName)
    {
    	this.CityName=CityName;
    }
    
	public static void setCities(String[] citiesStringArr) 
	{
		Cities.citiesStringArr = citiesStringArr;
		cities =  new List();
		for(int i=0;i<citiesStringArr.length;i++)
			cities.add(citiesStringArr[i]);
	}
    
	/**get functions*/
    public String getCityID()
	{
		return this.CityID;
	}
    
    public String getCityName()
	{
		return this.CityName;
	}
      
	public static String[] getCitiesStringArr()
	{
		return citiesStringArr;
	}

	public static List getCities() 
	{
		return cities;
	}

	/**function which adding new city and upgrade the city-array's list by 1*/
	public static void addCity(String city)
	{
		String tmp[] = new String[citiesStringArr.length+1];
		for(int i=0;i<tmp.length-1;i++)
		{
			tmp[i]=new String(citiesStringArr[i]);
		}
		tmp[tmp.length-1] = city;
		cities.add(city);
	}

}